import numpy as np


class Flatten:
    def __init__(self):
        self.x = None

    def __call__(self, x):
        self.x = x
        return x.reshape(-1)

    def backward(self, dout):
        return dout.reshape(self.x.shape)